package uba.fi.tda.tp3;

public class Grafo {
    
    public static int infinito = Integer.MAX_VALUE;
    
    private Vertice vertices[];
    private int cantidadVertices;
    
    public Grafo(int cantidadVertices) {
        this.cantidadVertices = cantidadVertices;
        this.vertices = new Vertice[cantidadVertices];
    }
    
    
    
    public Vertice[] getVertices() {
		return vertices;
	}



	public void setVertices(Vertice[] vertices) {
		this.vertices = vertices;
	}



	public int getCantidadVertices() {
		return cantidadVertices;
	}



	public void setCantidadVertices(int cantidadVertices) {
		this.cantidadVertices = cantidadVertices;
	}



	public void agregarArista(int verticeInicio, int verticeFin, int peso) {
        
       if(vertices[verticeInicio] == null)
           vertices[verticeInicio] = new Vertice(verticeInicio);
       
       if(vertices[verticeFin] == null)
           vertices[verticeFin] = new Vertice(verticeFin);
       
       vertices[verticeInicio].addAdyacente(new Arista(vertices[verticeFin], peso));
    }
	
	public void inicializarGrafo(){
		for(Vertice vertice:this.vertices){
			vertice.setCosto(infinito);
			vertice.setPadre(null);
			vertice.setProcesado(false);
		}
	}
    
}

